#include <unittest++/UnitTest++.h>

#include "fileoperations.h"

using std::string;

SUITE(FileOperationsTest)
{
    TEST(TestReadTextFile)
    {
	    string contents;
	    bool fileExists = FileOperations::readTextFile(contents, "../data/testdata/testfile.txt");
    	
	    CHECK(fileExists);
	    CHECK_EQUAL("line1\nline2\nline3\n", contents);
    }
        
    TEST(TestGetFileExtension)
    {
	    CHECK_EQUAL("txt", FileOperations::getFileExtension("file.txt"));
        CHECK_EQUAL("longextension", FileOperations::getFileExtension("this.file.longextension"));
        CHECK_EQUAL("", FileOperations::getFileExtension("file."));
        CHECK_EQUAL("", FileOperations::getFileExtension("file"));
    }
}
